package com.sright.bcard.common.service.share.enums;

/**
 * 模板类型 1：个人名片 2：企业名片
 */
public enum TemplateTypeEnum {

    PERSONAL("个人名片" , 1),
    ENTERPRISE("企业名片", 2),
    ;
    private String name;

    private Integer code;

    TemplateTypeEnum(String name, Integer code) {
        this.name = name;
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static TemplateTypeEnum getEnum(String name) {
        try {
            return valueOf(name);
        } catch (Exception e) {
            return null;
        }
    }


    public static TemplateTypeEnum getEnumByValue(String value) {
        if (value == null) {
            return null;
        }

        for (TemplateTypeEnum item : TemplateTypeEnum.values()) {
            if (item.getValue().equals(value)) {
                return item;
            }
        }
        return null;
    }

    public Integer getValue() {
        return code;
    }

    public void setValue(Integer code) {
        this.code = code;
    }

}
